<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            position: fixed;
            right: 0;
            bottom: 100px;
            width: 40px;
            height: 40px;
            background-color: orange;
            cursor: pointer;
            color: #fff;
        }
        .con {
            position: absolute;
            left: 0;
            top: 0;
            width: 200px;
            height: 40px;
            background-color: red;
            z-index: -1;
        }
    </style>
    <script src="animation.js"></script>
</head>
<body>
    <div class="box">
        <span>←</span>
        <div class="con"></div>
    </div>

    <script>
        var box = document.querySelector('.box');
        var con = document.querySelector('.con');
        box.addEventListener('mouseenter', function() {
            animationStart(con, -160,  function() {
                box.children[0].innerHTML = '→';
            });
        })

        box.addEventListener('mouseleave', function() {
            animationStart(con, 0, function() {
                box.children[0].innerHTML = '←';
            })
        })
    </script>
</body>
</html>

